package jmine.tec.hydra.services.validar;

import static jmine.tec.services.api.ActionsEnum.VALIDAR;
import jmine.tec.di.annotation.Injected;
import jmine.tec.hydra.api.HydraRequest;
import jmine.tec.hydra.domain.StatusHydraRequest;
import jmine.tec.services.annotations.Execution;
import jmine.tec.services.annotations.Input;
import jmine.tec.services.annotations.Parameter;
import jmine.tec.services.annotations.ServiceImplementor;
import junit.framework.Assert;
import bancosys.tec.persist.dao.BaseDAOFactory;
import bancosys.tec.persist.dao.BeanNotFoundException;

@ServiceImplementor(action = VALIDAR)
public class HydraRequestService {

    public static final String REQUEST = "Request";

    public static final String STATUS = "Status";

    public StatusHydraRequest status;

    @Execution
    public void execute(@Injected BaseDAOFactory daoFactory, @Parameter(REQUEST) HydraRequest request) throws BeanNotFoundException {
        if (this.status != null) {
            Assert.assertEquals(this.status, request.getStatus());
        }
    }

    /**
     * @param status - status;
     */
    @Input(fieldName = STATUS, required = false)
    public void setStatus(StatusHydraRequest status) {
        this.status = status;
    }

}
